using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ExperienceManager : MonoBehaviour
{
    public static ExperienceManager Instance;

    public delegate void ExperienceChangeHandler(int amount);
    public event ExperienceChangeHandler OnExperienceChanged;//经验改变事件
    private void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(gameObject);
        }else
            Instance = this;
    }

    /// <summary>
    /// 添加经验,敌人死了就会触发这个事件
    /// </summary>
    /// <param name="amount"></param>
    public void AddExperience(int amount)
    {
        OnExperienceChanged?.Invoke(amount);
    }
}
